add OrderBy param to subscription list #842
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
OrderBy
param to theSubscriptions
resourceTicket
Why
Current State
When querying accounts management service, we can use the
orderBy
param to order the result set.ocm-sdk provides a
.Order()
method to set this parameter when querying for subscriptions: https://github.com/openshift-online/ocm-sdk-go/blob/main/accountsmgmt/v1/subscriptions_client.go#L169-L186. So we can use this method like so to order on "status":However, when the request is sent, the sdk sets
order
on the request to AMS, notorderBy
. See here: https://github.com/openshift-online/ocm-sdk-go/blob/main/accountsmgmt/v1/subscriptions_client.go#L247-L249So this param gets ignored by AMS and the result set of the request is not ordered like intended.
In ocm cli terms:
is the request that gets sent by ocm-sdk now, which does not sort the result set
Proposed Change
We would provide an
OrderBy
method that is used like this (added a new method to not break existing functionality):which would generate the following request in ocm cli terms:
AMS apispec detailing the
orderBy
param: https://api.openshift.com/?urls.primaryName=Accounts%20management%20service#/default/get_api_accounts_mgmt_v1_subscriptionsCurrent Workaround
Right now we can get around this by setting the
orderBy
param explicitly like so:Testing
make model_version=HEAD model_url=../ocm-api-model generate
orderBy
param to the generated request to AMS